﻿using System;
using System.Windows.Input;
using Oxage.CNC.Models;

namespace Oxage.CNC.Commands
{
	public class SimulatorCommand : ICommand
	{
		#region Public properties
		public MainViewModel ViewModel
		{
			get;
			set;
		}
		#endregion

		#region ICommand Members
		public bool CanExecute(object parameter)
		{
			return true;
		}

		public event EventHandler CanExecuteChanged;
		protected virtual void OnCanExecuteChanged()
		{
			if (CanExecuteChanged != null)
			{
				CanExecuteChanged(this, new EventArgs());
			}
		}

		public void Execute(object parameter)
		{
			var command = parameter as string;
			switch (command)
			{
				case "QuickDraw":
					ViewModel.View.Simulator.ViewModel.Draw(ViewModel.Document.Content);
					break;

				case "Clear":
					ViewModel.View.Simulator.ViewModel.Clear();
					break;
			}
		}
		#endregion
	}
}
